/*
 * GPTASUIView.java
 */

package gptasui;

import org.jdesktop.application.Action;
import org.jdesktop.application.ResourceMap;
import org.jdesktop.application.SingleFrameApplication;
import org.jdesktop.application.FrameView;
import org.jdesktop.application.TaskMonitor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.Timer;
import javax.swing.Icon;
import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import java.io.File;

import Database.Database;
import UICommon.Table;
import java.awt.BorderLayout;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;

/**
 * The application's main frame.
 */
public class GPTASUIView extends FrameView {

    public GPTASUIView(SingleFrameApplication app) {
        super(app);

        initComponents();
        Initialize();
        

        // status bar initialization - message timeout, idle icon and busy animation, etc
        ResourceMap resourceMap = getResourceMap();
        int messageTimeout = resourceMap.getInteger("StatusBar.messageTimeout");
        messageTimer = new Timer(messageTimeout, new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                //statusMessageLabel.setText("");
            }
        });
        messageTimer.setRepeats(false);
        int busyAnimationRate = resourceMap.getInteger("StatusBar.busyAnimationRate");
        for (int i = 0; i < busyIcons.length; i++) {
            busyIcons[i] = resourceMap.getIcon("StatusBar.busyIcons[" + i + "]");
        }
        busyIconTimer = new Timer(busyAnimationRate, new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                busyIconIndex = (busyIconIndex + 1) % busyIcons.length;
                //tatusAnimationLabel.setIcon(busyIcons[busyIconIndex]);
            }
        });
        idleIcon = resourceMap.getIcon("StatusBar.idleIcon");
        //statusAnimationLabel.setIcon(idleIcon);
        //progressBar.setVisible(false);

        // connecting action tasks to status bar via TaskMonitor
        TaskMonitor taskMonitor = new TaskMonitor(getApplication().getContext());
        taskMonitor.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                String propertyName = evt.getPropertyName();
                if ("started".equals(propertyName)) {
                    if (!busyIconTimer.isRunning()) {
                        //statusAnimationLabel.setIcon(busyIcons[0]);
                        busyIconIndex = 0;
                        busyIconTimer.start();
                    }
                    //progressBar.setVisible(true);
                    //progressBar.setIndeterminate(true);
                } else if ("done".equals(propertyName)) {
                    busyIconTimer.stop();
                    //statusAnimationLabel.setIcon(idleIcon);
                   // progressBar.setVisible(false);
                   // progressBar.setValue(0);
                } else if ("message".equals(propertyName)) {
                    String text = (String)(evt.getNewValue());
                    //statusMessageLabel.setText((text == null) ? "" : text);
                    messageTimer.restart();
                } else if ("progress".equals(propertyName)) {
                    int value = (Integer)(evt.getNewValue());
                   // progressBar.setVisible(true);
                   // progressBar.setIndeterminate(false);
                   // progressBar.setValue(value);
                }
            }
        });
    }

    @Action
    public void showAboutBox() {
        if (aboutBox == null) {
            JFrame mainFrame = GPTASUIApp.getApplication().getMainFrame();
            mainFrame.setTitle("Group Project team Allocation System");
            aboutBox = new GPTASUIAboutBox(mainFrame);
            aboutBox.setLocationRelativeTo(mainFrame);
        }
        GPTASUIApp.getApplication().show(aboutBox);
    }

    private void Initialize()
    {
       DisplayAllocation();
    }

    private void DisplayAllocation()
    {
        try
        {
            Table.GetInstance()._set=Database.GetInstance().GetAllocations();
            JTable t= Table.GetInstance().GetTable();
            
            

            JScrollPane scroll=new JScrollPane(t);
            scroll.setVisible(true);
            JPanel pan=new JPanel();
            pan.add(scroll);
            pan.setSize(500,500);
            dlgAllocation.add(pan);
           
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        mainPanel = new javax.swing.JPanel();
        lblStatus = new javax.swing.JLabel();
        menuBar = new javax.swing.JMenuBar();
        javax.swing.JMenu fileMenu = new javax.swing.JMenu();
        javax.swing.JMenuItem exitMenuItem = new javax.swing.JMenuItem();
        jMenuItem1 = new javax.swing.JMenuItem();
        jMenuItem2 = new javax.swing.JMenuItem();
        javax.swing.JMenu helpMenu = new javax.swing.JMenu();
        javax.swing.JMenuItem aboutMenuItem = new javax.swing.JMenuItem();
        jScrollPane2 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();
        dlgConstraint = new javax.swing.JDialog();
        pnlConstraints = new javax.swing.JPanel();
        btnAddConstraint = new javax.swing.JButton();
        dlgNewAllocation = new javax.swing.JDialog();
        pnlNewAllocation = new javax.swing.JPanel();
        btnAllocate = new javax.swing.JButton();
        txtAllocationName = new javax.swing.JTextField();
        txtNoofGroups = new javax.swing.JTextField();
        lblAllocationName = new javax.swing.JLabel();
        lblNoofGroups = new javax.swing.JLabel();
        dlgStudents = new javax.swing.JDialog();
        pnlStudents = new javax.swing.JPanel();
        lblListofStudents = new javax.swing.JLabel();
        txtStudentFilePath = new javax.swing.JTextField();
        btnSelectFile = new javax.swing.JButton();
        dlgAllocation = new javax.swing.JDialog();

        mainPanel.setName("mainPanel"); // NOI18N

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(gptasui.GPTASUIApp.class).getContext().getResourceMap(GPTASUIView.class);
        lblStatus.setFont(resourceMap.getFont("lblStatus.font")); // NOI18N
        lblStatus.setText(resourceMap.getString("lblStatus.text")); // NOI18N
        lblStatus.setName("lblStatus"); // NOI18N

        javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel);
        mainPanel.setLayout(mainPanelLayout);
        mainPanelLayout.setHorizontalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(mainPanelLayout.createSequentialGroup()
                .addGap(24, 24, 24)
                .addComponent(lblStatus)
                .addContainerGap(1053, Short.MAX_VALUE))
        );
        mainPanelLayout.setVerticalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, mainPanelLayout.createSequentialGroup()
                .addContainerGap(815, Short.MAX_VALUE)
                .addComponent(lblStatus)
                .addContainerGap())
        );

        menuBar.setName("menuBar"); // NOI18N

        fileMenu.setText(resourceMap.getString("fileMenu.text")); // NOI18N
        fileMenu.setName("fileMenu"); // NOI18N

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(gptasui.GPTASUIApp.class).getContext().getActionMap(GPTASUIView.class, this);
        exitMenuItem.setAction(actionMap.get("quit")); // NOI18N
        exitMenuItem.setName("exitMenuItem"); // NOI18N
        fileMenu.add(exitMenuItem);

        jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem1.setText(resourceMap.getString("jMenuItem1.text")); // NOI18N
        jMenuItem1.setName("jMenuItem1"); // NOI18N
        jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        fileMenu.add(jMenuItem1);

        jMenuItem2.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_A, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem2.setText(resourceMap.getString("jMenuItem2.text")); // NOI18N
        jMenuItem2.setName("jMenuItem2"); // NOI18N
        jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem2ActionPerformed(evt);
            }
        });
        fileMenu.add(jMenuItem2);

        menuBar.add(fileMenu);

        helpMenu.setText(resourceMap.getString("helpMenu.text")); // NOI18N
        helpMenu.setName("helpMenu"); // NOI18N

        aboutMenuItem.setAction(actionMap.get("showAboutBox")); // NOI18N
        aboutMenuItem.setName("aboutMenuItem"); // NOI18N
        helpMenu.add(aboutMenuItem);

        menuBar.add(helpMenu);

        jScrollPane2.setName("jScrollPane2"); // NOI18N

        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jTable1.setName("jTable1"); // NOI18N
        jScrollPane2.setViewportView(jTable1);

        dlgConstraint.setName("dlgConstraint"); // NOI18N

        pnlConstraints.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("pnlConstraints.border.title"))); // NOI18N
        pnlConstraints.setName("pnlConstraints"); // NOI18N

        btnAddConstraint.setText(resourceMap.getString("btnAddConstraint.text")); // NOI18N
        btnAddConstraint.setName("btnAddConstraint"); // NOI18N

        javax.swing.GroupLayout pnlConstraintsLayout = new javax.swing.GroupLayout(pnlConstraints);
        pnlConstraints.setLayout(pnlConstraintsLayout);
        pnlConstraintsLayout.setHorizontalGroup(
            pnlConstraintsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlConstraintsLayout.createSequentialGroup()
                .addGap(144, 144, 144)
                .addComponent(btnAddConstraint)
                .addContainerGap(169, Short.MAX_VALUE))
        );
        pnlConstraintsLayout.setVerticalGroup(
            pnlConstraintsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlConstraintsLayout.createSequentialGroup()
                .addContainerGap(200, Short.MAX_VALUE)
                .addComponent(btnAddConstraint)
                .addGap(25, 25, 25))
        );

        javax.swing.GroupLayout dlgConstraintLayout = new javax.swing.GroupLayout(dlgConstraint.getContentPane());
        dlgConstraint.getContentPane().setLayout(dlgConstraintLayout);
        dlgConstraintLayout.setHorizontalGroup(
            dlgConstraintLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(dlgConstraintLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(pnlConstraints, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        dlgConstraintLayout.setVerticalGroup(
            dlgConstraintLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(dlgConstraintLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(pnlConstraints, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        dlgNewAllocation.setName("dlgNewAllocation"); // NOI18N

        pnlNewAllocation.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("pnlNewAllocation.border.title"))); // NOI18N
        pnlNewAllocation.setName("pnlNewAllocation"); // NOI18N

        btnAllocate.setText(resourceMap.getString("btnAllocate.text")); // NOI18N
        btnAllocate.setName("btnAllocate"); // NOI18N
        btnAllocate.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAllocateActionPerformed(evt);
            }
        });

        txtAllocationName.setText(resourceMap.getString("txtAllocationName.text")); // NOI18N
        txtAllocationName.setName("txtAllocationName"); // NOI18N

        txtNoofGroups.setText(resourceMap.getString("txtNoofGroups.text")); // NOI18N
        txtNoofGroups.setName("txtNoofGroups"); // NOI18N

        lblAllocationName.setText(resourceMap.getString("lblAllocationName.text")); // NOI18N
        lblAllocationName.setName("lblAllocationName"); // NOI18N

        lblNoofGroups.setText(resourceMap.getString("lblNoofGroups.text")); // NOI18N
        lblNoofGroups.setName("lblNoofGroups"); // NOI18N

        javax.swing.GroupLayout pnlNewAllocationLayout = new javax.swing.GroupLayout(pnlNewAllocation);
        pnlNewAllocation.setLayout(pnlNewAllocationLayout);
        pnlNewAllocationLayout.setHorizontalGroup(
            pnlNewAllocationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlNewAllocationLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlNewAllocationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblAllocationName)
                    .addComponent(lblNoofGroups))
                .addGap(18, 18, 18)
                .addGroup(pnlNewAllocationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btnAllocate)
                    .addComponent(txtAllocationName, javax.swing.GroupLayout.DEFAULT_SIZE, 240, Short.MAX_VALUE)
                    .addComponent(txtNoofGroups, javax.swing.GroupLayout.DEFAULT_SIZE, 240, Short.MAX_VALUE))
                .addContainerGap())
        );
        pnlNewAllocationLayout.setVerticalGroup(
            pnlNewAllocationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlNewAllocationLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlNewAllocationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblAllocationName)
                    .addComponent(txtAllocationName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(12, 12, 12)
                .addGroup(pnlNewAllocationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblNoofGroups)
                    .addComponent(txtNoofGroups, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(btnAllocate)
                .addContainerGap(33, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout dlgNewAllocationLayout = new javax.swing.GroupLayout(dlgNewAllocation.getContentPane());
        dlgNewAllocation.getContentPane().setLayout(dlgNewAllocationLayout);
        dlgNewAllocationLayout.setHorizontalGroup(
            dlgNewAllocationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 400, Short.MAX_VALUE)
            .addGroup(dlgNewAllocationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(dlgNewAllocationLayout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(pnlNewAllocation, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addContainerGap()))
        );
        dlgNewAllocationLayout.setVerticalGroup(
            dlgNewAllocationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 300, Short.MAX_VALUE)
            .addGroup(dlgNewAllocationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(dlgNewAllocationLayout.createSequentialGroup()
                    .addGap(66, 66, 66)
                    .addComponent(pnlNewAllocation, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(67, Short.MAX_VALUE)))
        );

        dlgStudents.setName("dlgStudents"); // NOI18N

        pnlStudents.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("pnlStudents.border.title"))); // NOI18N
        pnlStudents.setName("pnlStudents"); // NOI18N

        lblListofStudents.setText(resourceMap.getString("jListofStudents.text")); // NOI18N
        lblListofStudents.setName("jListofStudents"); // NOI18N

        txtStudentFilePath.setText(resourceMap.getString("txtStudentFilePath.text")); // NOI18N
        txtStudentFilePath.setName("txtStudentFilePath"); // NOI18N

        btnSelectFile.setText(resourceMap.getString("btnSelectFile.text")); // NOI18N
        btnSelectFile.setName("btnSelectFile"); // NOI18N
        btnSelectFile.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSelectFileActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout pnlStudentsLayout = new javax.swing.GroupLayout(pnlStudents);
        pnlStudents.setLayout(pnlStudentsLayout);
        pnlStudentsLayout.setHorizontalGroup(
            pnlStudentsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlStudentsLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(lblListofStudents)
                .addGap(18, 18, 18)
                .addComponent(txtStudentFilePath, javax.swing.GroupLayout.DEFAULT_SIZE, 134, Short.MAX_VALUE)
                .addGap(28, 28, 28)
                .addComponent(btnSelectFile)
                .addContainerGap())
        );
        pnlStudentsLayout.setVerticalGroup(
            pnlStudentsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlStudentsLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlStudentsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblListofStudents)
                    .addComponent(txtStudentFilePath, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnSelectFile))
                .addContainerGap(214, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout dlgStudentsLayout = new javax.swing.GroupLayout(dlgStudents.getContentPane());
        dlgStudents.getContentPane().setLayout(dlgStudentsLayout);
        dlgStudentsLayout.setHorizontalGroup(
            dlgStudentsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 400, Short.MAX_VALUE)
            .addGroup(dlgStudentsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(dlgStudentsLayout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(pnlStudents, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addContainerGap()))
        );
        dlgStudentsLayout.setVerticalGroup(
            dlgStudentsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 300, Short.MAX_VALUE)
            .addGroup(dlgStudentsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(dlgStudentsLayout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(pnlStudents, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addContainerGap()))
        );

        dlgAllocation.setName("dlgAllocation"); // NOI18N

        javax.swing.GroupLayout dlgAllocationLayout = new javax.swing.GroupLayout(dlgAllocation.getContentPane());
        dlgAllocation.getContentPane().setLayout(dlgAllocationLayout);
        dlgAllocationLayout.setHorizontalGroup(
            dlgAllocationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 400, Short.MAX_VALUE)
        );
        dlgAllocationLayout.setVerticalGroup(
            dlgAllocationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 300, Short.MAX_VALUE)
        );

        setComponent(mainPanel);
        setMenuBar(menuBar);
    }// </editor-fold>//GEN-END:initComponents

    private void btnSelectFileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSelectFileActionPerformed
        // TODO add your handling code here:
        try
        {
            jfc.showOpenDialog(GPTASUIApp.getApplication().getMainFrame());
            File file=jfc.getSelectedFile();
            String filepath=file.getAbsolutePath();
            if(filepath != null)
            {
                if(filepath.endsWith("xls"))
                txtStudentFilePath.setText(filepath);
            }
        }
        catch(Exception e)
        {

        }
    }//GEN-LAST:event_btnSelectFileActionPerformed

    private void NewAllocation()
    {
        try
        {
            Database.GetInstance().InsertAllocations(txtAllocationName.getText(),Integer.parseInt(txtNoofGroups.getText()));
        }
        catch(Exception e)
        {
            
        }
    }
    private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
        // TODO add your handling code here:
        dlgNewAllocation.setSize(400, 400);
        dlgNewAllocation.show();
    }//GEN-LAST:event_jMenuItem1ActionPerformed

    private void btnAllocateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAllocateActionPerformed
        // TODO add your handling code here:
        NewAllocation();
    }//GEN-LAST:event_btnAllocateActionPerformed

    private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed
        // TODO add your handling code here:
        dlgAllocation.setSize(600,600);
        dlgAllocation.show();
    }//GEN-LAST:event_jMenuItem2ActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnAddConstraint;
    private javax.swing.JButton btnAllocate;
    private javax.swing.JButton btnSelectFile;
    private javax.swing.JDialog dlgAllocation;
    private javax.swing.JDialog dlgConstraint;
    private javax.swing.JDialog dlgNewAllocation;
    private javax.swing.JDialog dlgStudents;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JTable jTable1;
    private javax.swing.JLabel lblAllocationName;
    private javax.swing.JLabel lblListofStudents;
    private javax.swing.JLabel lblNoofGroups;
    private javax.swing.JLabel lblStatus;
    private javax.swing.JPanel mainPanel;
    private javax.swing.JMenuBar menuBar;
    private javax.swing.JPanel pnlConstraints;
    private javax.swing.JPanel pnlNewAllocation;
    private javax.swing.JPanel pnlStudents;
    private javax.swing.JTextField txtAllocationName;
    private javax.swing.JTextField txtNoofGroups;
    private javax.swing.JTextField txtStudentFilePath;
    // End of variables declaration//GEN-END:variables

    private final Timer messageTimer;
    private final Timer busyIconTimer;
    private final Icon idleIcon;
    private final Icon[] busyIcons = new Icon[15];
    private int busyIconIndex = 0;

    private JDialog aboutBox;
    private JFileChooser jfc=new JFileChooser();
}
